{% extends 'store_admin/customers/base_customers.html' %}
{% load i18n %}

{% block m_mailing_list %}current_sub_menu{% endblock %}

{% block title_sub_menu %}{% trans "Mailing list" %}{% endblock %}

{% block toolbar %}
	{% block action %}
		{% if shop.mailinglist_feature_enabled %}
		<img id="gear" src="{{ MEDIA_URL }}img/gear.png"></img>
		<div id="actions_menu">
			<div id="title">{% trans "Actions" %}: {% trans "Mailing list" %}</div>
			<div id="action"><a href="{% url customers_export_mailinglist %}"><img src="{{ MEDIA_URL }}img/export.png" class="icon"/>{% trans "Export To CSV" %}</a></div>
		</div>
		{% endif %}
	{% endblock%}
{% endblock%}
	
{% block search %}
	<form method="POST" action="." class="form_search">
		<input type="text" name="search_text" value="{{ search_text }}"/>
	</form>
{% endblock %}

{% block main %}

{% if shop.mailinglist_feature_enabled %}
	
	<div class="clear"></div>
	<div class="bar_title">
		<div class="grid_1 alpha omega bar_column">
			<a href="./?sort_by=oldest"><img src="{{ MEDIA_URL }}img/icon_down.gif"/></a>
			<a href="./?sort_by=newest"><img src="{{ MEDIA_URL }}img/icon_up.gif"/></a>
		</div>
		<div class="grid_10 alpha omega bar_column"><b>{% trans "Mail" %}</b>
			<a href="./?sort_by=email"><img src="{{ MEDIA_URL }}img/icon_down.gif"/></a>
			<a href="./?sort_by=-email"><img src="{{ MEDIA_URL }}img/icon_up.gif"/></a>
		</div>
		<div class="clear"></div>
	</div>
	{% for member in mailing_list %}
		<div class="{% cycle 'row_1' 'row_2' %} row_small">
			<div class="grid_1 alpha omega column"><span>#{{ member.id }}</span></div>
			<div class="grid_10 alpha omega column"><span>{{ member.email }}</span></div>
			<div class="clear"></div>
		</div>
	{% empty %}
		<div class="notice">{% trans "There is no email registered yet" %}</div>
	{% endfor %}

{% else %}	
	<div class="enable_feature"><a class="enable_feature_box" href="{% url enable_feature 'mailinglist' %}">{% trans "Enable Mailing List Feature" %} for ${{ shop.mailinglist_feature_price }}</a><img src="{{ MEDIA_URL }}img/help-icon.png" onclick="javascript:show_help_text('htb_container');"/></div>
	
	<div class="htb_container">
		<img id="stick" src="{{ MEDIA_URL }}img/stick.png"/>
		<div class="help_text_box">
			{{ shop.mailinglist_feature_help_text }}
			<div class="close"><img onclick="javascript: close_help_text('htb_container')" src="{{ MEDIA_URL }}img/remove.png"/></div>
		</div>
	</div>
{% endif %}
		
{% endblock %}
